# 告警阀值设置页面测试
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage
import uuid
import random


class AlertSetting(KeyWords):
    url = KeyWords.url + 'worksite/alert-threshold-config'

    # 新建告警阀值
    def create_alert_setting(self):
        '''
        现建告警阀值
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\alert_setting\create_alert_setting.yaml')
        element_operation(self, data[0]['data'])
        return data[1]['assert_dict']

    # 告警阀值列表
    def alert_setting_list(self):
        '''
        告警阀值列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\alert_setting\alert_setting_list.yaml')
        element_operation(self, data[0]['data'])
        return data[1]['assert_dict']

    # 告警阀值列表
    def setting_list_update_delete(self):
        '''
        告警阀值修改和删除
        :return:
        '''
        data = get_data_by_yaml(
            get_path() + r'\Data\element_data\site_manage\alert_setting\alert_setting_update_delete.yaml')
        element_operation(self, data[0]['data'])
        return data[1]['assert_dict']


if __name__ == '__main__':
    try:
        driver = choose_browser()
        case = AlertSetting(driver)
        case.create_alert_setting()
    except:
        driver.quit()
    else:
        driver.quit()
